package com.foreknow.demo0928;

public class Swallow extends Bird {
    //子类中扩充的方法
    public void fly() {
        System.out.println(this.getName() + "正在飞");
    }

    public static void main(String[] args) {
        Bird bird = new Bird();
        bird.setName("鸟");
        bird.eat();
        System.out.println("--------------");
        Swallow swallow = new Swallow();
        swallow.setName("燕子");
        swallow.eat();
        swallow.fly();
    }
}
